﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WpfApp1
{
    public class Publisher
    {
        public event EventHandler? MyEvent = null;

        public void DoSomething()
        {
            Debug.WriteLine("Doing something ...");
            MyEvent?.Invoke(this, EventArgs.Empty);
        }
    }

    public class Subscriber { 
    
        public void MyEventHander(object? sender, EventArgs e)
        {
            Publisher? r = sender as Publisher;
            if (r != null)
            {
                
            }
            Debug.WriteLine("Event Received in Subscriber");
        }
    }
}
